<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <title>Insert title here</title>

</head>

<body>
    <section class="container">
        <div class="left">
            <div class="menu" id="abc">
                
            </div>
        </div>
        <div class="right">
            <div class="box1"></div>
            <div class="box2"></div>
        </div>
    </section>

    <script>
        ///遍历DOM树，访问所有节点
        const DFS = {
            nodes: [],
            do(root) {
                for (let i = 0; i < root.childNodes.length; i++) {
                    var node = root.childNodes[i];
                    // 过滤 text 节点、script 节点
                    if ((node.nodeType != 3) && (node.nodeName != 'SCRIPT')) {
                        this.nodes.push(node);
                        this.do(node);
                    }
                }
                return this.nodes;
            }
        }
        var a=2;
        console.log(a);//System.Out.Println()  print  printf cout
        console.log("liubotao")
        console.log(DFS.do(document.body));

        var el1 = document.getElementById("abc");  //获取id值为【abc】这个节点的引用
        // el1.innerHTML="<h1 style=\"color: red;\">asjdfklajskldjkl</h1>";
        // el1.innerHTML='<h1 style=\'color: red;\'>asjdfklajskldjkl</h1>';
        // el1.innerHTML="<h1 style='color: red;'>asjdfklajskldjkl</h1>";
        el1.innerHTML='<h1 style="color: blue;">asjdfklajskldjkl</h1>';
        console.log(el1.innerHTML);
        console.log(el1.innerText);
    </script>
</body>

</html>
